package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.BuyOrderBean;
import com.project.service.IBuyOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("buyOrder")
public class BuyOrderController {
    @Autowired
    private IBuyOrderService service;

    @RequestMapping("add")
    public String add(BuyOrderBean buyOrder) {
        service.add(buyOrder);
        return "ok";
    }
    
    @RequestMapping("findByOrderId")
    public BuyOrderBean findByOrderId(Integer buyOrderId) {
        return service.findByOrderId(buyOrderId);
    }

    @RequestMapping("findByItem")
    public IPage<BuyOrderBean> findByItem(Integer pageNO, String ventorName, LocalDate startDate, LocalDate endDate) {
        return service.findByItem(pageNO, ventorName, startDate, endDate);
    }
}
